package com.fengye.algorithms.leecode;

/**
 * @Author fengye
 * @Date 2023/4/18 7:29
 **/
public class PowerOfTwo231 {
    public static void main(String[] args) {
        System.out.println(2 & 1);
        System.out.println(3 & 1);
        System.out.println(4 & 1);
        System.out.println(5 & 1);
        new PowerOfTwo231().isPowerOfTwo(-2147483648);
    }
    public boolean isPowerOfTwo(int n) {
        while ((n & 1) == 0 && n != 0) {
            n /= 2;
        }

        if(n==1) {
            return true;
        }

        return false;
    }
}
